//
//  YXJLikeMusicCell.m
//  Piece
//
//  Created by dllo on 16/6/12.
//  Copyright © 2016年 Northeast Dianli University. All rights reserved.
//

#import "YXJLikeMusicCell.h"

@implementation YXJLikeMusicCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
//        self.allComment = [[UILabel alloc] init];
//        self.allComment.textColor = [UIColor colorWithRed:0.76 green:0.76 blue:0.76 alpha:1.00];
//        self.allComment.text = @"共   条评论";
//        self.allComment.font = [UIFont systemFontOfSize:13];
//        [self.contentView addSubview:_allComment];
//        
//        self.allCommentButton = [UIButton buttonWithType:UIButtonTypeCustom];
//        [self.allCommentButton setTitle:@"全部评论" forState:UIControlStateNormal];
//        [self.allCommentButton setTitleColor:[UIColor colorWithRed:0.54 green:0.74 blue:0.89 alpha:1.00] forState:UIControlStateNormal];
//        self.allCommentButton.titleLabel.font = [UIFont systemFontOfSize:13];
//        [self.allCommentButton addTarget:self action:@selector(didButton:) forControlEvents:UIControlEventTouchUpInside];
//        [self.contentView addSubview:_allCommentButton];
        
        self.lineView = [[UIView alloc] init];
        self.lineView.backgroundColor = [UIColor colorWithRed:0.89 green:0.89 blue:0.88 alpha:1.00];
        [self.contentView addSubview:_lineView];
        
        self.likeMusicLabel = [[UILabel alloc] init];
        self.likeMusicLabel.text = @"相似歌曲";
        self.likeMusicLabel.font = [UIFont systemFontOfSize:15];
        self.likeMusicLabel.textColor = [UIColor colorWithRed:0.76 green:0.76 blue:0.76 alpha:1.00];
        self.likeMusicLabel.font = [UIFont systemFontOfSize:13];
        [self.contentView addSubview:_likeMusicLabel];
        
        self.playButton = [UIButton buttonWithType:UIButtonTypeCustom];
        [self.playButton setImage:[UIImage imageNamed:@"music_list_play_normal"] forState:UIControlStateNormal];
        [self.playButton addTarget:self action:@selector(didPlayButton:) forControlEvents:UIControlEventTouchUpInside];
        self.isPlay = NO;
        [self.contentView addSubview:_playButton];
    }
    return self;
    
}

//- (void)didButton:(UIButton *)sender
//{
//    NSLog(@"点击了按钮");
//}

- (void)didPlayButton:(UIButton *)sender
{
    if (self.isPlay == NO) {
    [sender setImage:[UIImage imageNamed:@"music_list_pause_normal"] forState:UIControlStateNormal];
    self.isPlay = YES;
    }else
    {
    [sender setImage:[UIImage imageNamed:@"music_list_play_normal"] forState:UIControlStateNormal];
    self.isPlay = NO;
    }
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    
//    self.allComment.frame = CGRectMake(10, 10, 150, 20);
//    
//    self.allCommentButton.frame = CGRectMake(ScreenWidth - 80, _allComment.frame.origin.y, 70, 20);
    
//    self.lineView.frame = CGRectMake(_allComment.frame.origin.x, _allComment.frame.origin.y + _allComment.frame.size.height + 4, ScreenWidth, 2);
    
//    self.likeMusicLabel.frame = CGRectMake(_allComment.frame.origin.x, _allComment.frame.origin.y + _allComment.frame.size.height + 10, 100, 20);
    
    self.likeMusicLabel.frame = CGRectMake(10, 10, 100, 20);
    
    self.playButton.frame = CGRectMake(ScreenWidth - 40, _likeMusicLabel.frame.origin.y, 32, 32);
}

@end
